<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/5
 * Time: 23:51
 */

namespace luo\exception;


use luo\Exception;

class PDOException extends Exception
{

    public function __construct(\PDOException $exception)
    {

        $error = $exception->errorInfo;
        $errorData = [
            'sqlstate' => $error[0],
            'code'     => $error[1],
            'message'  => $error[2]
        ];

        $this->code = $exception->getCode();

        $this->message = $exception->getMessage();

        $this->set('PDOError', $errorData);

    }

}